package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectTaskTagApi;
import com.nbsaas.boot.project.api.domain.request.ProjectTaskTagRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectTaskTagResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectTaskTagSimple;
import com.nbsaas.boot.project.data.entity.ProjectTaskTag;
import com.nbsaas.boot.project.data.repository.ProjectTaskTagRepository;
import com.nbsaas.boot.project.rest.convert.ProjectTaskTagEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTaskTagResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTaskTagSimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   任务标签-业务接口实现
 */
@Transactional
@Service
public class ProjectTaskTagResource extends BaseResource<ProjectTaskTag, ProjectTaskTagResponse, ProjectTaskTagSimple, ProjectTaskTagRequest> implements ProjectTaskTagApi {

    @Resource
    private ProjectTaskTagRepository projectTaskTagRepository;

    @Override
    public JpaRepositoryImplementation<ProjectTaskTag, Serializable> getJpaRepository() {
        return projectTaskTagRepository;
    }

    @Override
    public Function<ProjectTaskTag, ProjectTaskTagSimple> getConvertSimple() {
        return new ProjectTaskTagSimpleConvert();
    }

    @Override
    public Function<ProjectTaskTagRequest, ProjectTaskTag> getConvertForm() {
        return new ProjectTaskTagEntityConvert();
    }

    @Override
    public Function<ProjectTaskTag, ProjectTaskTagResponse> getConvertResponse() {
        return new ProjectTaskTagResponseConvert();
    }


}


